package com.xingzuo.library_pay.ui;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.PagerAdapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.xingzuo.base.ui.mvp.base.ui.BaseMvpActivity;
import com.xingzuo.library_pay.R;
import com.xingzuo.library_pay.R2;
import com.xingzuo.library_pay.adapter.PayAdapter;
import com.xingzuo.library_pay.bean.PayBean;
import com.xingzuo.library_pay.contract.PayContract;
import com.xingzuo.library_pay.presenter.PayPresenter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class PayActivity extends BaseMvpActivity<PayPresenter> implements PayContract.View {
    @BindView(R2.id.rv_pay)
    RecyclerView rvPay;
    private PayAdapter adapter;
    private List<PayBean> payBeanList=new ArrayList<>();
    @Override
    public PayPresenter getPresenter() {
        return new PayPresenter();
    }

    @Override
    public int getView() {
        return R.layout.activity_pay;
    }

    @Override
    public void initView() {
        adapter=new PayAdapter(R.layout.item_pay,new ArrayList<>());
        GridLayoutManager gridLayoutManager=new GridLayoutManager(this,3);
        rvPay.setLayoutManager(gridLayoutManager);
    }

    @Override
    public void initLinsenterner() {
        adapter.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {

            }
        });
    }

    @Override
    public void getData() {
        payBeanList.add(new PayBean(true,"30","3000"));
        payBeanList.add(new PayBean(false,"30","3000"));
        payBeanList.add(new PayBean(false,"30","3000"));
        payBeanList.add(new PayBean(false,"30","3000"));
        payBeanList.add(new PayBean(false,"30","3000"));
        payBeanList.add(new PayBean(false,"30","3000"));
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}